package com.org.redis.lru;

import com.org.redis.lock.RLock;

import java.util.HashMap;
import java.util.Map;

public class Test {

    int count = 0;
    RLock lock = new RLock();
    public void c(){
        lock.lock();
        System.out.println("in");
        count++;
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        lock.unlock();
        System.out.println("out");
    }

    public static void main(String[] args) {
        Test test = new Test();

        Map<String,String> map1 = new HashMap<>();

       // LRURedisMap map1 = new LRURedisMap(1000005, "test_map3");
//        for (int i=0;i<2684;i++){
//            map1.put(String.valueOf(i),String.valueOf(i));
//        }
//        long startTime = System.currentTimeMillis(); //获取开始时间

        new Thread(new Runnable() {
            @Override
            public void run() {
                test.c();
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                test.c();
            }
        }).start();

//        long endTime = System.currentTimeMillis(); //获取结束时间
//
//        System.out.println("程序运行时间：" + (endTime - startTime) + "ms"); //输出程序运行时间
    }
}
